package com.huangjue.backend.mapper;

import com.huangjue.backend.entity.VideoFinish;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface VideoFinishMapper {

    /**
     * 插入视频观看记录
     */
    int insertVideoFinish(VideoFinish videoFinish);

    /**
     * 根据用户ID、demoID和视频ID查询观看记录
     */
    VideoFinish selectByUserAndVideo(@Param("userId") Integer userId,
                                    @Param("demoId") Integer demoId,
                                    @Param("videoId") Integer videoId);

    /**
     * 根据用户ID和demoID查询所有观看记录
     */
    List<VideoFinish> selectByUserAndDemo(@Param("userId") Integer userId,
                                         @Param("demoId") Integer demoId);

    /**
     * 删除观看记录
     */
    int deleteVideoFinish(@Param("userId") Integer userId,
                         @Param("demoId") Integer demoId,
                         @Param("videoId") Integer videoId);
}
